{% extends "base.html" %}

{% block title %}File Manager{% endblock %}

{% block scripts %}
	{{ parent() }}
	<script type="text/javascript" src="{{ settings.assets_url }}javascript/jquery.redirect.min.js"></script>
{% endblock %}

{% block servername %}
<ul class="nav navbar-nav">
	<li class="active dynUpdate" id="{{ server.id }}"><a><i id="applyUpdate" class="fa fa-circle-o-notch fa-spinner fa-spin"></i> {{ server.name }}</a></li>
</ul>
{% endblock %}

{% block sidebar %}
<div class="list-group">
	<a href="#" class="list-group-item list-group-item-heading"><strong>{{ lang.sidebar_acc_actions }}</strong></a>
	<a href="../../account.php" class="list-group-item">{{ lang.sidebar_settings }}</a>
	<a href="../../totp.php" class="list-group-item">TOTP {{ lang.sidebar_settings }}</a>
	<a href="../../servers.php" class="list-group-item">{{ lang.sidebar_servers }}</a>
</div>
<div class="list-group">
	<a href="#" class="list-group-item list-group-item-heading"><strong>{{ lang.sidebar_server_acc }}</strong></a>
	<a href="../index.php" class="list-group-item">{{ lang.sidebar_overview }}</a>
	<a href="index.php" class="list-group-item active">{{ lang.sidebar_files }}</a>
	{% if permission.users.view == true %}<a href="../users/list.php" class="list-group-item">Manage Subusers</a>{% endif %}
	<a href="../settings.php" class="list-group-item">{{ lang.sidebar_manage }}</a>
	<a href="../plugins/index.php" class="list-group-item">{{ lang.sidebar_plugins }}</a>
</div>
{% endblock %}

{% block content %}
<div class="col-9" id="internal_alert">
	<div class="alert alert-info">
		<i class="fa fa-spinner fa-spin"></i> {{ lang.node_files_loading }}
	</div>
</div>
<div class="row">
	<div class="col-9">
		<div class="files_loading_box"><i class="fa fa-refresh fa-spin" id="position_me"></i></div>
	</div>
	<div class="col-9" id="load_files"></div>
</div>
<script type="text/javascript">
$(window).load(function(){function i(i){if(i===!0){var l=$("#get_height").height(),e=$(".files_loading_box").width(),a=l/2-15,t=e/2-15;$("#position_me").css({top:a,left:t}),$(".files_loading_box").css("height",l+5).fadeIn()}else $(".files_loading_box").fadeOut()}function l(){$("a.load_new").click(function(e){if(e.preventDefault(),i(!0),null!=$.urlParam("dir",$(this).attr("href"))){var a=$.urlParam("dir",$(this).attr("href"));$.ajax({type:"POST",url:"../ajax/files/list_dir.php",data:{dir:a},success:function(e){$("#load_files").slideUp(function(){$("#load_files").html(e),i(!1),$("#load_files").slideDown(),l()})}})}else $.ajax({type:"POST",url:"../ajax/files/list_dir.php",data:{},success:function(e){$("#load_files").slideUp(function(){$("#load_files").html(e),i(!1),$("#load_files").slideDown(),l()})}})}),$("a.edit_file").click(function(i){i.preventDefault();var l=$.urlParam("file",$(this).attr("href"));$().redirect("edit.php",{file:l})})}function e(){if($("#loading_dir").fadeIn(200),$("#internal_alert").slideDown(),null!=$.urlParam("dir",$(location).attr("href"))&&a===!1){var i=$.urlParam("dir",$(location).attr("href"));$("#loading_dir").fadeIn(200),$.ajax({type:"POST",url:"../ajax/files/list_dir.php",data:{dir:i},success:function(i){$("#load_files").slideUp(function(){$("#load_files").html(i),$("#internal_alert").slideUp(),$("#load_files").slideDown(),$("#loading_dir").fadeOut(200),a=!0,l()})}})}else $("#loading_dir").fadeIn(200),$.ajax({type:"POST",url:"../ajax/files/list_dir.php",data:{},success:function(i){$("#load_files").slideUp(function(){$("#load_files").html(i),$("#internal_alert").slideUp(),$("#load_files").slideDown(),$("#loading_dir").fadeOut(200),a=!0,l()})}})}$.urlParam=function(i,l){var e=new RegExp("[\\?&]"+i+"=([^&#]*)").exec(decodeURIComponent(l));return null==e?null:e[1]||0};var a=!1;e()});
</script>
{% endblock %}
